package games.ninJumpDx.data
{
	import flash.display.DisplayObject;
	import flash.filters.DisplacementMapFilter;

	public class UIConfig
	{
		private static var PLACES_INFO:XML =
			<places width="768" height="1024">
			    <item name="ninja" x="105" y="700" left="105" right="663" gravity=".008" speedX=".2" top="650" linkName="ninja"/>
				<item name="pause_button" x="695" y="953" linkName="pause_button"/>
				<item name="castle_button" x="500" y="800" linkName="castle_button"/>
				<item name="options_button" x="500" y="900" linkName="options_button"/>
			    <item name="back_button" x="0" y="400" linkName="back_button"/>
				<item name="bridge" x="100" y="-100" z="-1" linkName="bridge"/>
				<item name="chain" x="128" y="-100" z="-1" linkName="chain"/>
				<item name="drawbridge" x="0" y="-100" z="1" linkName="drawbridge"/>
				<item name="drawbridge_reversion" x="768" y="-100" z="1" scaleX="-1" linkName="drawbridge"/>
				<item name="score_bar" x="272" y="2" linkName="score_bar"/>
				<item name="music_on" x="550" y="290" linkName="on_button"/>
				<item name="music_off" x="550" y="290" linkName="off_button" />
				<item name="sound_on" x="550" y="180" linkName="on_button"/>
				<item name="sound_off" x="550" y="180" linkName="off_button" />
				<item name="knight" x="125" y="-100" z="1" linkName="knight"/>
				<item name="knight_reversion" x="643" y="-100" z="1" scaleX="-1" linkName="knight"/>
				<item name="archer1" x="0" y="-100" z="1" linkName="archer1"/>
				<item name="archer1_reversion" x="768" y="-100" z="1" scaleX="-1" linkName="archer1"/>
				<item name="catapult1" x="0" y="-100" z="1" linkName="catapult1"/>
				<item name="catapult1_reversion" x="768" y="-100" z="1" scaleX="-1" linkName="catapult1"/>
				<item name="horse" x="125" y="-100" z="1" linkName="horse"/>
				<item name="horse_reversion" x="643" y="-100" z="1" scaleX="-1" linkName="horse"/>
				<item name="troll" x="105" y="-205" z="1" linkName="troll" left="105" right="663"/>
				<item name="troll_reversion" x="663" y="-205" z="1" scaleX="-1" linkName="troll" left="105" right="663"/>
				<item name="arrow" x="105" y="-50" linkName="arrow"/>
				<item name="arrow_reversion" x="663" y="-50" scaleX="-1" linkName="arrow"/>
				<item name="boulder" x="105" y="-150" linkName="boulder1"/>
				<item name="boulder_reversion" x="663" y="-150" scaleX="-1" linkName="boulder1"/>
				<item name="dragon" x="-400" y="0" linkName="dragon1"/>
				<item name="dragon_reversion" x="1168" y="0" scaleX="-1" linkName="dragon1"/>
				<item name="dragon_wing" x="-400" y="350" linkName="dragon_wing"/>
				<item name="dragon_wing_reversion" x="1168" y="350" scaleX="-1" linkName="dragon_wing"/>
				<item name="gargoyle_frozen" x="105" y="-100" linkName="gargoyle_frozen"/>
				<item name="gargoyle_frozen_reversion" x="663" y="-100" scaleX="-1" linkName="gargoyle_frozen"/>
				<item name="gargoyle" x="0" y="0" linkName="gargoyle"/>
				<item name="gargoyle_reversion" x="628" y="-150" scaleX="-1" linkName="gargoyle"/>
			</places>
		
		public static function getInfoByName(n:String):XMLList
		{
			return 	PLACES_INFO.*.(@name == n);
		}
		
		public static function getGameHeight():Number
		{
			return Number(PLACES_INFO.@height);
		}
		
		public static function getGameWidth():Number
		{
			return Number(PLACES_INFO.@width);
		}
		
		public static function setCenter(mc:DisplayObject):void
		{
			setCenterX(mc);
			setCenterY(mc);
		}
		
		public static function setCenterX(mc:DisplayObject):void
		{
			mc.x = (PLACES_INFO.@width - mc.width) / 2;
		}
		
		public static function setCenterY(mc:DisplayObject):void
		{
			mc.y = (PLACES_INFO.@height - mc.height) / 2;	
		}
	}
}